/*
 * Zirco Browser for Android
 * 
 * Copyright (C) 2010 J. Devauchelle and contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 3 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package com.android.love.web;


/**
 * Url 管理工具
 */
public class UrlUtils {

	/**
	 * 检查字符串是否是一个url
	 */
	public static boolean isUrl(String url) {
		return url.contains(".");
	}

	/**
	 * 检查一个url，如果非http://开头，增加之
	 * 
	 * @param url
	 * @return
	 */
	public static String checkUrl(String url) {
		if ((url != null) && (url.length() > 0)) {

			if ((!url.startsWith("http://")) && (!url.startsWith("https://"))
					&& (!url.startsWith("file://"))) {

				url = "http://" + url;

			}
		}

		return url;
	}

}
